package main
import (
	"log"
	"net/http"
	"text/template"
)

type GGD struct{
	Name string	//产品名称
	Type string	//产品类型
	Number string	//出厂编号
	Date string	//出厂日期
	Dj1 float32	//电气间隙1
	Dj2 float32	//电气间隙2
	Pd1 float32	//爬电距离1
	Pd2 float32	//爬电距离2
	Jddz1 float32	//接地电阻1
	Jddz2 float32	//接地电阻2
	Jddz3 float32	//接地电阻3
	Jddz4 float32	//接地电阻4
	Jddz5 float32	//接地电阻5
	Jydz float32	//绝缘电阻
}

func main(){
	http.HandleFunc("/", Index)
	log.Println("Serve Listen ...")
	http.ListenAndServe(":8000", nil)
}

func Index(writer http.ResponseWriter, request *http.Request){
	
	xinxi := GGD{
		Name:"低压配电柜",
		Type:"GGD",
		Number:"1809001",
		Date:"2018年09月07日",
		Dj1:55,
		Dj2:66,
		Pd1:77,
		Pd2:88,
		Jddz1:11,
		Jddz2:22,
		Jddz3:33,
		Jddz4:44,
		Jddz5:55,
		Jydz:500,
	}
	
	/*第一步，解析文件*/
	t, err := template.ParseFiles("./tab.html")
	
	/*第二步，出始化*/
	tmp := template.Must(t, err)
	
	/*第三步，应用*/
	tmp.Execute(writer, xinxi)
	
}